<template>
  <div class="box">
    <van-nav-bar
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    >
    <template #title>
      <div class="container">
        <div class="left">
          <div class="left-address">{{$store.state.address.address.area}}</div>
          <div class="left-time">{{getTime}}</div>
        </div>
        <div class="middle">
          <div class="middle-time">{{$store.state.address.timeDistance}}</div>
          <div class="middle-img">
            <img src="../../../assets/image/arrow.png" alt="">
          </div>
        </div>
        <div class="right">
          <div class="right-address">{{$store.state.address.address.area}}</div>
          <div class="right-time">{{alsoTime}}</div>
        </div>
      </div>
    </template>
    </van-nav-bar>
  </div>
</template>

<script>
export default {
  name: "NavBar",
  data() {
    return {
    };
  },
  computed: {
    getTime () {
      let day = this.$store.state.address.date.get.day
      let time = this.$store.state.address.date.get.hour
      return day + " " + time
    },
    alsoTime () {
      let day = this.$store.state.address.date.also.day
      let time = this.$store.state.address.date.also.hour
      return day + " " + time
    }
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1)
    },

    onClickRight () {

    }
  },
};
</script>

<style lang="scss" scoped>
.wrapper {
  .container {
    display: flex;
    justify-content: space-around;
    font-size: 11px;
    background-color: #f2f3f6;
    width: 220px;
    height: 35px;
    .left {
      &-address {
        height: 16px;
      }
      &-time {
        color: #999;
      }
    }
    .right {
      &-address {
        height: 16px;
      }
      &-time {
        color: #999;
      }
    }
    .middle {
      &-time {
        height: 16px;
        margin-top: 5px;
      }
      &-img {
        margin-top: -10px;
        img {
          height: 5.5px;
          width: 50px;
        }
      }
    }
  }
}
</style>